import 'package:flutter/material.dart';

class TapMask extends StatelessWidget {
  final Widget child;

  final Color? splashColor;

  final Function? onTap;

  final double borderRadius;

  TapMask({
    required this.child,
    this.splashColor,
    this.onTap,
    this.borderRadius = 0,
  });

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: <Widget>[
        child,
        Positioned.fill(
          child: Material(
            color: Colors.transparent,
            child: InkWell(
              onTap: () {
                if (onTap != null) {
                  onTap!();
                }
              },
              borderRadius: BorderRadius.circular(borderRadius),
              highlightColor: Colors.transparent,
              splashColor: splashColor,
            ),
          ),
        ),
      ],
    );
  }
}
